<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>登录</title>
    <#assign base=request.contextPath/>
    <meta name="author" content="DeathGhost" />
    <link rel="stylesheet" type="text/css" href="${base}/backstage/denglu/css/style.css" tppabs="${base}/backstage/denglu/css/style.css" />
    <link rel="stylesheet" href="${base}/backstage/layui/css/layui.css">

    <style>
        body{height:100%;background:#16a085;overflow:hidden;}
        canvas{z-index:-1;position:absolute;}
    </style>
    <script src="${base}/backstage/denglu/js/jquery.js"></script>
    <script src="${base}/backstage/denglu/js/verificationNumbers.js" tppabs="${base}/backstage/denglu/js/verificationNumbers.js"></script>
    <script src="${base}/backstage/denglu/js/Particleground.js" tppabs="${base}/backstage/denglu/js/Particleground.js"></script>
    <script type="text/javascript" src="${base}/backstage/layui/layui.js"></script>

    <script>
        $(document).ready(function() {
            //粒子背景特效
            $('body').particleground({
                dotColor: '#5cbdaa',
                lineColor: '#5cbdaa'
            });
            //验证码
            createCode();
        });
    </script>
</head>
<body>
<dl class="admin_login" >
    <dt>
        <strong>扫码点餐后台管理系统</strong>
        <em>sweepOrder Management system</em>
    </dt>
    <dd class="user_icon">
        <input type="text" placeholder="请输入账号" id="account" class="login_txtbx"/>
    </dd>
    <dd class="pwd_icon">
        <input type="password" placeholder="请输入密码" id="passWord" class="login_txtbx"/>
    </dd>

    <dd>
        <input type="button" value="立即登陆" onclick="login()" class="submit_btn"/>
    </dd>
</dl>
</body>
<script>
    layui.use(['table', 'form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , $ = layui.jquery
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , table = layui.table;
    })
    function login() {
        if ($("#account").val() == "" || $("#account").val() == null) {
            layui.layer.msg("请输入账户", {icon: 5})
            return;
        }
        if ($("#passWord").val() == "" || $("#passWord").val() == null) {
            layui.layer.msg("请输入密码", {icon: 5})
            return;
        }
        $.ajax({
            type: "POST",
            url: "${base}/user/login",
            data: {
                "account": $("#account").val(),
                "passWord": $("#passWord").val()
            },
            success: function (data) {
                if (data.code === 200) {
                        window.location.href = "${base}/user/index.html"
                }else{
                    layui.layer.msg(data.msg, {icon: 5})
                }

            }
        });
    }

    //键盘事件
    $("body").bind("keydown",function(e){
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            //回车执行查询
            $("#login").click();
        }
    });
</script>
</html>
